#include <stdio.h>
#include <windows.h>
#include <stdlib.h>
#include <conio.h>

bool status;

typedef struct Project
{
    long projectId;
    char projectName[999];
    short projectStatus; //0为未开始，1为进行中，2为已完成
    short projectAwards; //0为未获奖，1为1等奖(500)，2为2等奖(300)，3为三等奖(100)
    struct Project *nextProject;
} Project, *ProjectList;

typedef struct Thesis
{
    long thesisId;
    char thesisName[999];
    short thesisStatus; //0为未开始，1为进行中，2为已完成
    short thesisAwards; //0为未获奖，1国家级，2为省部级，3为市厅级,4为校级
    short thesisType;   //0为无，1为SCI(500)，2为EI(300)，3为核心(100)，4为一般(50)
    struct Thesis *nextThesis;
} Thesis, *ThesisList;
typedef struct Essay
{
    long essayId;
    char essayName[999];
    short essayType; //0为无，1为国家标准(500)，2为行业标准(300)，3为专辑(200)，4为学术专著(100)，5为其他（含译著）(50)
    struct Essay *nextEssay;
} Essay, *EssayList;

typedef struct User
{
    long length; //可以使用这个来记录长度

    long id;
    char name[10]; //姓名
    User *nextUser;
    Project *nextProject;
    Thesis *nextThesis;
    Essay *nextEssay;

} User, *UserList;


bool ShowAllUser(UserList user);
bool ShowAllProject(UserList user);
bool ShowAllThesis(UserList user);
bool ShowAllEssay(UserList user);
void Set(UserList head);
void SetUser(UserList head);
void InformationPanel(UserList head);
void SetInformation(UserList head);
void SetProjuct(UserList head);
void ProjectPanel(UserList head);
void ThesisPanel(UserList head);
void SetThesis(UserList head);
void BackMenu(UserList head);


UserList InitUser()
{
    UserList head = (UserList)malloc(sizeof(User));

    //记录长度
    head->length = 0;

    head->nextUser = NULL;
    head->nextProject = NULL;
    head->nextThesis = NULL;
    head->nextEssay = NULL;
    head->id = 0;
    if (NULL == head)
    {
        printf("链表动态分配失败！程序终止！\n");
        exit(-1);
    }
    return head;
}
bool AddUser(UserList head, long id, char name[10])
{
    if (head == NULL)
    {
        return false;
    }
    UserList user = (UserList)malloc(sizeof(User));
    UserList temp = (UserList)malloc(sizeof(User));
    user->id = id;
    strcpy(user->name,name);
    // essay->essayName[999] = essayName;
    if (head->nextUser == NULL)
    {

        head->nextUser = user;
        user->nextUser = NULL;

        //新加上
        user->nextProject = NULL;
        user->nextEssay = NULL;
        user->nextThesis = NULL;

    }
    else
    {
        temp = head->nextUser;
        while(temp->nextUser != NULL)
        {
            temp = temp->nextUser;
        }
        temp->nextUser = user;
        user->nextUser = NULL;

        //新加上
        user->nextProject = NULL;
        user->nextEssay = NULL;
        user->nextThesis = NULL;
    }
    head->length++;
    return true;
}
bool AddProject(UserList user,
                long projectId,
                char projectName[999],
                short projectStatus,
                short projectAwards)
{
    if (user == NULL)
    {
        return false;
    }
    ProjectList project = (ProjectList)malloc(sizeof(Project));
    ProjectList temp = (ProjectList)malloc(sizeof(Project));
    project->projectId = projectId;
    strcpy(project->projectName, projectName);

    project->projectStatus = projectStatus;
    project->projectAwards = projectAwards;
    if (user->nextProject == NULL)
    {
        user->nextProject = project;
        project->nextProject = NULL;
    }
    else
    {
        temp = user->nextProject;
        while (temp->nextProject != NULL)
        {
            temp = temp->nextProject;
        }
        temp->nextProject = project;
        project->nextProject = NULL;
    }
    return true;
}
bool AddThesis(
                UserList user,
                long thesisId,
                char thesisName[999],
                char thesisUserName[432],
                short thesisStatus,
                short thesisAwards,
                short thesisType
                )
{
    if (user == NULL)
    {
        return false;
    }
    ThesisList thesis = (ThesisList)malloc(sizeof(Thesis));
    ThesisList temp = (ThesisList)malloc(sizeof(Thesis));
    thesis->thesisId = thesisId;
    // thesis->thesisName[999] = thesisName[999];
    // thesis->thesisUserName[432] = thesisUserName[432];
    strcpy( thesis->thesisName,thesisName);
    thesis->thesisStatus = thesisStatus;
    thesis->thesisAwards = thesisAwards;
    thesis->thesisType = thesisType;
    if (user->nextThesis == NULL)
    {
        user->nextThesis = thesis;
        thesis->nextThesis = NULL;
    }
    else
    {
        temp = user->nextThesis;
        while (temp->nextThesis != NULL)
        {
            temp = temp->nextThesis;
        }
        temp->nextThesis = thesis;
        thesis->nextThesis = NULL;
    }
    return true;
}

bool AddEssay(UserList user, long essayId, char essayName[999])
{
    if (user == NULL)
    {
        return false;
    }
    EssayList essay = (EssayList)malloc(sizeof(Essay));
    EssayList temp = (EssayList)malloc(sizeof(Essay));
    essay->essayId = essayId;
    strcpy(essay->essayName,essayName);
    // essay->essayName[999] = essayName;
    if (user->nextEssay == NULL)
    {
        user->nextEssay = essay;
        essay->nextEssay = NULL;
    }
    else
    {
        temp = user->nextEssay;
        while (temp->nextEssay != NULL)
        {
            temp = temp->nextEssay;
        }
        temp->nextEssay = essay;
        essay->nextEssay = NULL;
    }
    return true;
}

UserList SearchUser(UserList head,long id)
{
    UserList temp = (UserList)malloc(sizeof(User));
     if (head->nextUser == NULL || head == NULL)
    {
        status = 0;
        exit(-1);
    }
    else
    {
        temp = head->nextUser;
        if (temp->id == id)
        {
            status = 1;
            return temp;
        }
        while (temp->nextUser != NULL)
        {
            temp = temp->nextUser;
            if (temp->id == id)
            {
                status = 1;
                return temp;
            }
        }
    }
    status = 0;
    return temp;
}

ProjectList SearchProject(UserList user,long projectId)
{
    ProjectList temp = (ProjectList)malloc(sizeof(Project));
     if (user->nextUser == NULL || user == NULL)
    {
        status = 0;
        exit(-1);
    }
    else
    {
        temp = user->nextProject;
        if (temp->projectId == projectId)
        {
            status = 1;
            return temp;
        }
        while (temp->nextProject != NULL)
        {
            temp = temp->nextProject;
            if (temp->projectId == projectId)
            {
                status = 1;
                return temp;
            }
        }
    }
    status = 0;
    return temp;
}

ThesisList SearchThesis(UserList user,long thesisId)
{
    ThesisList temp = (ThesisList)malloc(sizeof(Thesis));
     if (user->nextUser == NULL || user == NULL)
    {
        status = 0;
        exit(-1);
    }
    else
    {
        temp = user->nextThesis;
        if (temp->thesisId == thesisId)
        {
            status = 1;
            return temp;
        }
        while (temp->thesisId != NULL)
        {
            temp = temp->nextThesis;
            if (temp->thesisId == thesisId)
            {
                status = 1;
                return temp;
            }
        }
    }
    status = 0;
    return temp;
}

EssayList SearchEssay(UserList user,long essayId)
{
    EssayList temp = (EssayList)malloc(sizeof(Essay));
     if (user->nextUser == NULL || user == NULL)
    {
        status = 0;
        exit(-1);
    }
    else
    {
        temp = user->nextEssay;
        if (temp->essayId == essayId)
        {
            status = 1;
            return temp;
        }
        while (temp->essayId != NULL)
        {
            temp = temp->nextEssay;
            if (temp->essayId == essayId)
            {
                status = 1;
                return temp;
            }
        }
    }
    status = 0;
    return temp;
}

bool DeleteUser(UserList head, long id)
{
    UserList lastTemp = (UserList)malloc(sizeof(User));
    UserList temp = (UserList)malloc(sizeof(User));
     if (head->nextUser == NULL || head == NULL)
    {
        status = 0;
        exit(-1);
    }
    else
    {
        temp = head->nextUser;
        if (temp->id == id)
        {
            head->nextUser = temp->nextUser;
            free(temp);
            head->length--;
            return true;
        }
        lastTemp = temp;
        while (temp->nextUser != NULL)
        {
            temp = temp->nextUser;
            if (temp->id == id)
            {
                lastTemp->nextUser = temp->nextUser;
                free(temp);
                head->length--;
                return true;
            }
            lastTemp = temp;
        }
    }
    return false;
}



bool ShowAllUser(UserList head)
{
    UserList temp = (UserList)malloc(sizeof(User));
    temp = head;
    if (head->nextUser == NULL)
    {
        printf("表不存在，查询失败");
        free(temp);
        return false;
    }
    else
    {
        while (temp->nextUser != NULL)
        {
            temp = temp->nextUser;
            printf("ID:%ld 名字:%s \n", temp->id, temp->name);
            //在输出项目等数据之前输出一下名字，可能会删
            printf("%s \n", temp->name);
            ShowAllProject(temp);
            ShowAllThesis(temp);
            ShowAllEssay(temp);
        }
        free(temp);
        return true;
    }
}

bool ShowAllProject(UserList user)
{
    ProjectList temp = (ProjectList)malloc(sizeof(ProjectList));
    temp = user->nextProject;
    if(user->nextProject == NULL){
        printf("该人员没有所属项目\n");
        free(temp);
        return false;
    }else{
        while(temp->nextProject != NULL){
            printf("所属项目:%s 项目状态:%s 获奖状况:%s\n",
			temp->projectName,
			temp->projectStatus==0?"未开始":temp->projectStatus==1?"进行中":"已完成",
			temp->projectAwards==0?"未获奖":temp->projectAwards==1?"一等奖":temp->projectAwards==2?"二等奖":temp->projectAwards==3?"三等奖":"四等奖");
            temp = temp->nextProject;
        }
        printf("所属项目:%s 项目状态:%s 获奖状况:%s\n",
			temp->projectName,
			temp->projectStatus==0?"未开始":temp->projectStatus==1?"进行中":"已完成",
			temp->projectAwards==0?"未获奖":temp->projectAwards==1?"一等奖":temp->projectAwards==2?"二等奖":temp->projectAwards==3?"三等奖":"四等奖");
    }
    free(temp);
    return true;
}
bool ShowAllThesis(UserList user){
    ThesisList temp = (ThesisList)malloc(sizeof(ThesisList));
    temp = user->nextThesis;
    if(temp == NULL||temp->nextThesis == NULL){
        printf("该人员没有论文\n");
        free(temp);
        return false;
    }else{
        temp = temp->nextThesis;
        while(temp->nextThesis != NULL){
            printf("论文名称:%s 论文ID:%ld 论文状态:%s 获奖情况%s 论文类型%s \n",
			temp->thesisName,
			temp->thesisId,
			temp->thesisStatus==0?"未开始":temp->thesisStatus==1?"进行中":"已完成",
			temp->thesisAwards==0?"未获奖":temp->thesisAwards==1?"国家级":temp->thesisAwards?"省部级":temp->thesisAwards==2?"市厅级":"校级",
			temp->thesisType==0?"SCI":temp->thesisType==1?"EI":temp->thesisType==2?"核心":"一般");
        }
		printf("论文名称:%s 论文ID:%ld 论文状态:%s 获奖情况%s 论文类型%s \n",
			temp->thesisName,
			temp->thesisId,
			temp->thesisStatus==0?"未开始":temp->thesisStatus==1?"进行中":"已完成",
			temp->thesisAwards==0?"未获奖":temp->thesisAwards==1?"国家级":temp->thesisAwards?"省部级":temp->thesisAwards==2?"市厅级":"校级",
			temp->thesisType==0?"SCI":temp->thesisType==1?"EI":temp->thesisType==2?"核心":"一般");
    }

    free(temp);
    return true;
}
bool ShowAllEssay(UserList user)
{
    EssayList temp = (EssayList)malloc(sizeof(EssayList));
    temp = user->nextEssay;
    if (user->nextEssay == NULL)
    {
        printf("该人员没有引用的著作\n");
        free(temp);
        return false;
    }
    else
    {
        while (temp->nextEssay != NULL)
        {
            printf("著作名称:%s 著作ID:ld% 著作类型%s\n",
                   temp->essayName,
                   temp->essayId,
                   temp->essayType == 0 ? "无" : temp->essayType == 1 ? "国家标准" : temp->essayType ==2? "行业标准" : temp->essayType == 3 ? "专辑" : temp->essayType == 4 ?"学术专著" : "其他(含译著)");
        }
        printf("著作名称:%s 著作ID:ld% \n",
               temp->essayName,
               temp->essayId,
               temp->essayType == 0 ? "无" : temp->essayType == 1 ? "国家标准" : temp->essayType ==2? "行业标准" : temp->essayType == 3 ? "专辑" : temp->essayType == 4 ?"学术专著" : "其他(含译著)");
    }

    free(temp);
    return (true);
}

bool ShowUserAll(UserList user)
{
	if(user == NULL)
	{
		return false;
	}
    UserList temp = (UserList)malloc(sizeof(User));
    temp = user;
    printf("ID:%ld 名字:%s \n",temp->id,temp->name);
    //在输出项目等数据之前输出一下名字，可能会删
    printf("%s \n",temp->name);
    ShowAllProject(temp);
    ShowAllThesis(temp);
    ShowAllEssay(temp);
    return true;
}
bool DeleteProject(UserList user, long projectId)
{
    ProjectList lastTemp = (ProjectList)malloc(sizeof(Project));
    ProjectList temp = (ProjectList)malloc(sizeof(Project));
     if (user->nextUser == NULL || user == NULL)
    {
        status = 0;
        exit(-1);
    }
    else
    {
        temp = user->nextProject;
        if (temp->projectId == projectId)
        {
            user->nextProject = temp->nextProject;
            free(temp);
            // head->length--;
            return true;
        }
        lastTemp = temp;
        while (temp->nextProject != NULL)
        {
            temp = temp->nextProject;
            if (temp->projectId == projectId)
            {
                lastTemp->nextProject = temp->nextProject;
                free(temp);
                // head->length--;
                return true;
            }
            lastTemp = temp;
        }
    }
    return false;
}

bool DeleteThesis(UserList user, long thesisId)
{
    ThesisList lastTemp = (ThesisList)malloc(sizeof(Thesis));
    ThesisList temp = (ThesisList)malloc(sizeof(Thesis));
     if (user->nextUser == NULL || user == NULL)
    {
        status = 0;
        exit(-1);
    }
    else
    {
        temp = user->nextThesis;
        if (temp->thesisId == thesisId)
        {
            user->nextThesis = temp->nextThesis;
            free(temp);
            // head->length--;
            return true;
        }
        lastTemp = temp;
        while (temp->nextThesis != NULL)
        {
            temp = temp->nextThesis;
            if (temp->thesisId == thesisId)
            {
                lastTemp->nextThesis = temp->nextThesis;
                free(temp);
                // head->length--;
                return true;
            }
            lastTemp = temp;
        }
    }
    return false;
}

bool DeleteEssay(UserList user, long essayId)
{
    EssayList lastTemp = (EssayList)malloc(sizeof(Essay));
    EssayList temp = (EssayList)malloc(sizeof(Essay));
     if (user->nextUser == NULL || user == NULL)
    {
        status = 0;
        exit(-1);
    }
    else
    {
        temp = user->nextEssay;
        if (temp->essayId == essayId)
        {
            user->nextEssay = temp->nextEssay;
            free(temp);
            // head->length--;
            return true;
        }
        lastTemp = temp;
        while (temp->nextEssay != NULL)
        {
            temp = temp->nextEssay;
            if (temp->essayId == essayId)
            {
                lastTemp->nextEssay = temp->nextEssay;
                free(temp);
                // head->length--;
                return true;
            }
            lastTemp = temp;
        }
    }
    return false;
}


void ShowAllUserApp(UserList head){
    ShowAllUser(head);
}

































void Menu(UserList head) //主界面
{
    system("cls");
    //system("color A0"); //更改主菜单颜色
    printf("欢迎使用德州学院科研信息管理系统！\n");
    printf("\t\t\t\t================================================\n");
    printf("\t\t\t\t| 1:查询信息             |                     |\n");
    printf("\t\t\t\t| 2:人员操作面板         |                     |\n");
    printf("\t\t\t\t| 3:项目操作面板         |                     |\n");
    printf("\t\t\t\t| 4:论文管理面板         |                     |\n");
    printf("\t\t\t\t| 5:退出系统             |                     |\n");
    printf("\t\t\t\t================================================\n");
    printf("请选择:");
    Set(head); //调用功能选择函数
}


//查询信息面板
void InformationPanel(UserList head)
{
    system("cls");
    printf("欢迎使用德州学院科研信息管理系统！\n");
    printf("\t\t\t\t=================================================\n");
    printf("\t\t\t\t| >>>>  1:查询信息       |  6:显示所有人员      |\n");
    printf("\t\t\t\t| 2:人员操作面板         |  7:查询人员详细信息  |\n");
    printf("\t\t\t\t| 3:项目操作面板         |  8:显示所有项目      |\n");
    printf("\t\t\t\t| 4:论文管理面板         |  9:显示所有论文      |\n");
    printf("\t\t\t\t| 5:退出系统             | 10:返回主菜单        |\n");
    printf("\t\t\t\t=================================================\n");
    printf("请选择:");
    SetInformation(head);
}
//操作用户面板
void UserPanel(UserList head)
{
    system("cls");
    printf("欢迎使用德州学院科研信息管理系统！\n");
    printf("\t\t\t\t================================================\n");
    printf("\t\t\t\t| 1:查询信息             | 6:增加人员信息      |\n");
    printf("\t\t\t\t| >>>>  2:人员操作面板   | 7:修改人员信息      |\n");
    printf("\t\t\t\t| 3:项目操作面板         | 8:删除人员信息      |\n");
    printf("\t\t\t\t| 4:论文管理面板         | 9:返回主菜单        |\n");
    printf("\t\t\t\t| 5:退出系统             |                     |\n");
    printf("\t\t\t\t================================================\n");
    printf("请选择:");
    SetUser(head);
}
void ProjectPanel(UserList head)
{
    system("cls");
    printf("欢迎使用德州学院科研信息管理系统！\n");
    printf("\t\t\t\t================================================\n");
    printf("\t\t\t\t| 1:查询信息             |                     |\n");
    printf("\t\t\t\t| 2:人员操作面板         |                     |\n");
    printf("\t\t\t\t| >>>>  3:项目操作面板   |                     |\n");
    printf("\t\t\t\t| 4:论文管理面板         |                     |\n");
    printf("\t\t\t\t| 5:退出系统             |                     |\n");
    printf("\t\t\t\t================================================\n");
    printf("请选择:");
    SetProjuct(head);
}
void ThesisPanel(UserList head)
{

    system("cls");
    printf("欢迎使用德州学院科研信息管理系统！\n");
    printf("\t\t\t\t================================================\n");
    printf("\t\t\t\t| 1:查询信息             |                     |\n");
    printf("\t\t\t\t| 2:人员操作面板         |                     |\n");
    printf("\t\t\t\t| 3:项目操作面板         |                     |\n");
    printf("\t\t\t\t| >>>>  4:论文管理面板   |                     |\n");
    printf("\t\t\t\t| 5:退出系统             |                     |\n");
    printf("\t\t\t\t================================================\n");
    printf("请选择:");
    SetThesis(head);
}

void Set(UserList head)
{
    fflush(stdin); //清除缓冲区，防止读入回车符
    int a = (int)_getch();
    switch (a)
    {
    case '1':

        fflush(stdin); //清除缓冲区，防止读入回车符
        InformationPanel(head);
        //Error();       //返回主菜单
        break;
    case '2':

        UserPanel(head);
        fflush(stdin); //清除缓冲区，防止读入回车符
        //DisplayAll();  //显示所有信息
        //Error();       //返回主菜单
        break;
    case '3':

        fflush(stdin); //清除缓冲区，防止读入回车符
        ProjectPanel(head);
        //Error();       //返回主菜单
        break;
    case '4':

        fflush(stdin); //清除缓冲区，防止读入回车符
        ThesisPanel(head);
        //Error();       //返回主菜单
        break;
    case '5':

        //DelAll();      //清空所有信息
        exit(-1);
        break;
    default:
        printf("请重新输入有效序号:\n");
        Set(head); //重新加载主菜单
    }
}


//查询信息
void SetInformation(UserList head)
{
    fflush(stdin); //清除缓冲区，防止读入回车符
    char a = _getch();
    switch (a)
    {
    case '1':

        fflush(stdin); //清除缓冲区，防止读入回车符
        InformationPanel(head);
        //Error();       //返回主菜单
        break;
    case '2':

        UserPanel(head);
        fflush(stdin); //清除缓冲区，防止读入回车符
        //DisplayAll();  //显示所有信息
        //Error();       //返回主菜单
        break;
    case '3':

        fflush(stdin); //清除缓冲区，防止读入回车符
        ProjectPanel(head);
        //Error();       //返回主菜单
        break;
    case '4':

        fflush(stdin); //清除缓冲区，防止读入回车符
        ThesisPanel(head);
        //Error();       //返回主菜单
        break;
    case '5':

        //DelAll();      //清空所有信息
        exit(-1);
        break;
    case '6':
        fflush(stdin);
        ShowAllUser(head);
        BackMenu(head);

    default:
        printf("请重新输入有效序号:\n");
        Set(head); //重新加载主菜单
    }
}

void SetProjuct(UserList head)
{
    fflush(stdin); //清除缓冲区，防止读入回车符
    char a = _getch();
    switch (a)
    {
    case '1':

        fflush(stdin); //清除缓冲区，防止读入回车符
        InformationPanel(head);
        //Error();       //返回主菜单
        break;
    case '2':

        UserPanel(head);
        fflush(stdin); //清除缓冲区，防止读入回车符
        //DisplayAll(head);  //显示所有信息
        //Error();       //返回主菜单
        break;
    case '3':

        fflush(stdin); //清除缓冲区，防止读入回车符
        ProjectPanel(head);
        //Error();       //返回主菜单
        break;
    case '4':

        fflush(stdin); //清除缓冲区，防止读入回车符
        ThesisPanel(head);
        break;
    case '5':

        //DelAll();      //清空所有信息
        exit(-1);
        break;
    default:
        printf("请重新输入有效序号:\n");
        Set(head); //重新加载主菜单
    }

}



void SetUser(UserList head)
{
    fflush(stdin); //清除缓冲区，防止读入回车符
    char a = _getch();
    switch (a)
    {
    case '1':

        fflush(stdin); //清除缓冲区，防止读入回车符
        InformationPanel(head);
        //Error();       //返回主菜单
        break;
    case '2':

        UserPanel(head);
        fflush(stdin); //清除缓冲区，防止读入回车符
        //DisplayAll();  //显示所有信息
        //Error();       //返回主菜单
        break;
    case '3':

        fflush(stdin); //清除缓冲区，防止读入回车符
        ProjectPanel(head);
        //Error();       //返回主菜单
        break;
    case '4':

        fflush(stdin); //清除缓冲区，防止读入回车符
        ThesisPanel(head);
        //Error();       //返回主菜单
        break;
    case '5':

        //DelAll();      //清空所有信息
        exit(-1);
        break;
    default:
        printf("请重新输入有效序号:\n");
        Set(head); //重新加载主菜单
    }
}


void SetThesis(UserList head)
{
        fflush(stdin); //清除缓冲区，防止读入回车符
    char a = _getch();
    switch (a)
    {
    case '1':

        fflush(stdin); //清除缓冲区，防止读入回车符
        InformationPanel(head);
        //Error();       //返回主菜单
        break;
    case '2':

        UserPanel(head);
        fflush(stdin); //清除缓冲区，防止读入回车符
        //DisplayAll();  //显示所有信息
        //Error();       //返回主菜单
        break;
    case '3':

        fflush(stdin); //清除缓冲区，防止读入回车符
        ProjectPanel(head);
        //Error();       //返回主菜单
        break;
    case '4':

        fflush(stdin); //清除缓冲区，防止读入回车符
        ThesisPanel(head);
        //Error();       //返回主菜单
        break;
    case '5':

        //DelAll();      //清空所有信息
        exit(-1);
        break;
    default:
        printf("请重新输入有效序号:\n");
        Set(head); //重新加载主菜单
    }
}



//回到主菜单
void BackMenu(UserList head)
{
    printf("操作完成，即将返回主菜单\n请");
    system("pause");
    Menu(head);

}

int main(int argc, char const *argv[])
{
    UserList head;
    UserList user;
    char name[10] = "fadsf";
    char essayName[999] = "trweyusfdghfhjdfghj";
    head = InitUser();
    AddUser(head,230201, name);
    AddUser(head,33020, name);
    AddUser(head,330201, name);
    AddUser(head,430201, name);
    AddUser(head,530201, name);
    AddUser(head,430201, name);
    AddUser(head,530201, name);
    AddUser(head,630201, name);
    AddUser(head,230201, name);
    AddUser(head,230201, name);
    AddEssay(head,54, essayName);
    AddEssay(SearchUser(head,230201),4354, essayName);
    AddEssay(SearchUser(head,33020),543, essayName);
    AddProject(SearchUser(head,430201), 453 , essayName, 3, 2);
    AddProject(SearchUser(head,530201), 432,essayName, 3, 2);
    AddProject(SearchUser(head,33020), 423,essayName, 3, 2);
    AddThesis(SearchUser(head,33020), 423,essayName, essayName, 3, 2, 4);
    AddThesis(SearchUser(head,630201), 423,essayName, essayName, 3, 2, 2);
    AddThesis(SearchUser(head,630201), 645,essayName, essayName, 3, 2, 4);
    user = SearchUser(head,430201);
	printf("%ld",SearchProject(user,453)->projectId);
    if ( status  )
    {
        printf("%ld",user->id);
        printf("成功");
    }else
    {
        printf("失败");
    }

/*

if ( DeleteUser(head,33020) )
    {
        printf("成功");
    }else
    {
        printf("失败");
    }
*/


/*
    user = SearchUser(head,33020);
    if ( status  )
    {
        printf("%ld",user->id);
        printf("成功");
    }else
    {
        printf("失败");
    }

*/
    printf("\n");
    Menu(head);


    free(head);
    system("pause");
    return 0;
}
